5 ' Etch A Sketch program detailled step by step
10 DEFINT A-Z: ' Defines all variables to integer by default
20 V=PEEK(45): ' V= MSX generation ID
30 COLOR 11,11,6: ' Changes colors
40 SCREEN 4+(V=0)*2,1: ' Changes screen mode to mode 2 or 4
50 FOR I=1 TO 8
60 READ L:A$=A$+CHR$(L): ' Reads data for sprite 0
70 READ L: B$=B$+CHR$(L): ' Reads data for sprite 1
80 NEXT
90 SPRITE$(0)=A$:SPRITE$(1)=B$: ' Defines the shape of sprites
100 IF V THEN COLOR SPRITE(0)=1:COLOR SPRITE(1)=78 ELSE PUTSPRITE0,,1: PUTSPRITE1,,15: ' Defines the color(s) of sprites for MSX2 or MSX1
110 PUTSPRITE 0,(X,Y): PUTSPRITE 1,STEP(0,0): PSET STEP(0,1): ' Displays the cursor and draws
120 IF STRIG(0) THEN COLOR 1: VDP(1)=VDP(1) AND 254: ' Drawing
130 IF NOT PEEK(&HFBED) AND 32 THEN Y=Y+(Y>-1): ' Moving and condition for the top
140 IF NOT PEEK(&HFBED) AND 128 THEN X=X-(X<255): ' Moving and condition for the bottom
150 IF NOT PEEK(&HFBED) AND 64 THEN Y=Y-(Y<210): ' Moving and condition for the right
160 IF NOT PEEK(&HFBED) AND 16 THEN X=X+(X>0): ' Moving and condition for the left
170 IF NOT PEEK(&HFBED) AND 2 THEN SOUND7,183: PLAY"t255L5v10av7fv11b": COLOR 11: VDP(1)=VDP(1)OR 1: IF V THEN D=VDP(19): FORI=0TO30: VDP(19)=RND(1)*255: NEXT: VDP(19)=D: CLS ELSE CLS ' Condition and routine to erase the screen
180 GOTO 110:' Loop
190 ' Data for the shape of sprites
200 DATA 124,0,252,120,184,112,156,120,174,92,215,14,10,4,4,0
